import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsString, Length, Matches } from "class-validator";

export class CreateUserDto {
    @IsString()
    @IsNotEmpty()
    @Length(3, 10)
    @Matches(/^[a-zA-Z0-9]/, {
        message: '用户名只能是字母、数字'
    })
    @ApiProperty({name:"username" , enum:["admin" , "user"]})
    username: string;

    @IsString()
    @IsNotEmpty()
    @Length(3, 10)
    @ApiProperty({name:"password"})
    password: string;

}